import socket


def main():
    client = socket.socket()
    client.connect(('192.168.1.10', 9090))
    strData_dic = {"electronicsPath": "/home/zhaokaiyue/Desktop/test/electronicsPath/11.png",
                   "satellitePath": {
                       "lastX": 64,
                       "lastY": 608,
                       "satellitePathList": [
                           [
                               "/home/zhaokaiyue/Desktop/测试图像/2020-12-11/d246a34dd200432581fbd4cf12509826.jpg",
                               "/home/zhaokaiyue/Desktop/测试图像/2020-12-11/6cf68ca8618a491a99f1494ae7206eff.jpg"],
                           [
                               "/home/zhaokaiyue/Desktop/测试图像/12.14/2/a15898ef954044978b2bc93d456e3591.jpg",
                               "/home/zhaokaiyue/Desktop/测试图像/12.14/2/b600339ed5ea454bbb7b879f2e40e30d.jpg"
                           ]
                       ]
                   }
                   }

    while True:
        data = str(strData_dic)
        if not data:
            print("输入的不能为空")
            continue
        client.send(data.encode("utf-8"))
        cmd_data_size = client.recv(1024)

        received_data_size = 0
        received_data = b''
        print(cmd_data_size)

        while received_data_size < int(cmd_data_size):
            cmd_data = client.recv(1024)
            received_data_size += len(cmd_data)
            received_data += cmd_data
        else:
            print("收到的消息长度", received_data.decode())

    client.close()


if __name__ == '__main__':
    main()